{extend name="public/base"/}
{block name="style"}
<link rel="stylesheet" href="/public/lboyue/m/css/loading.css?v=20180507">
<script type="text/javascript" src="/public/lboyue/m/sitejs/book.js?v=20181123"></script>
<script type="text/javascript">

    $(document).ready(function () {


        $('.moreIco').click(function () {

            if($(this).hasClass('closeIco')){

                $('#header').removeClass('app_headerFixed2');
                $(this).removeClass('closeIco');
                $('.app_header_second').hide();
                $('.app_meskSection').hide();

            }else{

                $('#header').addClass('app_headerFixed2');
                $(this).addClass('closeIco');
                $('.app_header_second').show();
                $('.app_meskSection').show();
            }



        })

        $('body').on('click','.app_meskSection',function () {
            $('.app_header_second').hide();
            $('.app_meskSection').hide();
            $('#header').removeClass('app_headerFixed2');
            $('.moreIco').removeClass('closeIco');
        })
    })

</script>
{/block}
{block name="body"}
<div class="app_goBackToTop"></div>
<div class="app_meskSection"></div>

<div class="container">

    <div class="app_header_section2  app_scrollerHeader" id="header">
        <div class="app_header_detail2">
            <div class="app_header_back"></div>
            <div class="app_header_h1">
                书库                <a href="/personal/bookcase.html"> <i class="shujiaIco"></i></a>
                <i class="moreIco"></i>
            </div>
        </div>
		{include file="public/dropnav" /}
	</div>



    <div class="app_body">
        

    <div class="app_listBlock app_deleteMargin">

        <div class="app_shukuBlock" id="classification">

            <ul>
                                <li>
                    <span class="type">类型：</span>
                    <span class="list">
                         <a href="{:url('/books')}?channel=&cate={$cate}&fullflag={$fullflag}&size={$size}&upday={$upday}&isvip={$isvip}&order={$order}"  {if condition="($channel=='')"}class="active"{/if}>不限</a>
                        <a href="{:url('/books')}?channel=1&cate={$cate}&fullflag={$fullflag}&size={$size}&upday={$upday}&isvip={$isvip}&order={$order}"  {if condition="($channel==1)"}class="active"{/if}>男频</a><a href="{:url('/books')}?channel=2&cate={$cate}&fullflag={$fullflag}&size={$size}&upday={$upday}&isvip={$isvip}&order={$order}"  {if condition="($channel==2)"}class="active"{/if}>女频</a>                    </span>
                </li>
                
                <li>
                    <span class="type">分类：</span>
                    <span class="list">
					<a href="{:url('/books')}?channel={$channel}&cate=0&fullflag={$fullflag}&size={$size}&upday={$upday}&isvip={$isvip}&order={$order}" class="{if condition="($cate == 0)"}active{/if}">全部</a>
					{volist name="category" id="vo"}
						<a href="{:url('/books')}?channel={$channel}&cate={$vo.id}&fullflag={$fullflag}&size={$size}&upday={$upday}&isvip={$isvip}&order={$order}" class="{eq name="vo.id" value="$cate"}active{/eq}">{$vo.title}</a>
					{/volist}
					</span>
                </li>
                
                <li>
                    <span class="type">字数：</span>
                    <span class="list">
                        <a href="{:url('/books')}?channel={$channel}&cate={$cate}&fullflag={$fullflag}&size=&upday={$upday}&isvip={$isvip}&order={$order}" {if condition="($size=='')"}class="active"{/if}>不限</a>
                        <a href="{:url('/books')}?channel={$channel}&cate={$cate}&fullflag={$fullflag}&size=1&upday={$upday}&isvip={$isvip}&order={$order}"  {if condition="($size==1)"}class="active"{/if}>30万以下</a>
                        <a href="{:url('/books')}?channel={$channel}&cate={$cate}&fullflag={$fullflag}&size=2&upday={$upday}&isvip={$isvip}&order={$order}"  {if condition="($size==2)"}class="active"{/if}>30-50万</a>
                        <a href="{:url('/books')}?channel={$channel}&cate={$cate}&fullflag={$fullflag}&size=3&upday={$upday}&isvip={$isvip}&order={$order}"  {if condition="($size==3)"}class="active"{/if}>50-100万</a>
                        <a href="{:url('/books')}?channel={$channel}&cate={$cate}&fullflag={$fullflag}&size=4&upday={$upday}&isvip={$isvip}&order={$order}"  {if condition="($size==4)"}class="active"{/if}>100万以上</a>
                   </span>
                </li>

                <li>
                    <span class="type">排序：</span>
                    <span class="list">
                        <a href="{:url('/books')}?channel={$channel}&cate={$cate}&fullflag={$fullflag}&size={$size}&upday={$upday}&isvip={$isvip}&order=" {if condition="($order=='')"}class="active"{/if}>不限</a>
                        <a href="{:url('/books')}?channel={$channel}&cate={$cate}&fullflag={$fullflag}&size={$size}&upday={$upday}&isvip={$isvip}&order=1"  {if condition="($order==1)"}class="active"{/if}>最新更新</a>
                        <a href="{:url('/books')}?channel={$channel}&cate={$cate}&fullflag={$fullflag}&size={$size}&upday={$upday}&isvip={$isvip}&order=2"  {if condition="($order==2)"}class="active"{/if}>订阅排行</a>
                        <a href="{:url('/books')}?channel={$channel}&cate={$cate}&fullflag={$fullflag}&size={$size}&upday={$upday}&isvip={$isvip}&order=3" {if condition="($order==3)"}class="active"{/if} >点击排行</a>
                    </span>
                </li>

                <li>
                    <span class="type">更新：</span>
                    <span class="list">
                        <a  href="{:url('/books')}?channel={$channel}&cate={$cate}&fullflag={$fullflag}&size={$size}&upday=&isvip={$isvip}&order={$order}" {if condition="($upday=='')"}class="active"{/if}>不限</a>
                        <a  href="{:url('/books')}?channel={$channel}&cate={$cate}&fullflag={$fullflag}&size={$size}&upday=1&isvip={$isvip}&order={$order}"  {if condition="($upday==1)"}class="active"{/if}>三日内</a>
                        <a  href="{:url('/books')}?channel={$channel}&cate={$cate}&fullflag={$fullflag}&size={$size}&upday=2&isvip={$isvip}&order={$order}"  {if condition="($upday==2)"}class="active"{/if}>七日内</a>
                        <a  href="{:url('/books')}?channel={$channel}&cate={$cate}&fullflag={$fullflag}&size={$size}&upday=3&isvip={$isvip}&order={$order}"  {if condition="($upday==3)"}class="active"{/if}>半月内</a>
                        <a  href="{:url('/books')}?channel={$channel}&cate={$cate}&fullflag={$fullflag}&size={$size}&upday=4&isvip={$isvip}&order={$order}"  {if condition="($upday==4)"}class="active"{/if}>一月内</a>
                    </span>
                </li>

                <li>
                    <span class="type">收费：</span>
                    <span class="list">
                        <a href="{:url('/books')}?channel={$channel}&cate={$cate}&fullflag={$fullflag}&size={$size}&upday={$upday}&isvip=&order={$order}" {if condition="($isvip=='')"}class="active"{/if}>不限</a>
                        <a href="{:url('/books')}?channel={$channel}&cate={$cate}&fullflag={$fullflag}&size={$size}&upday={$upday}&isvip=0&order={$order}"  {if condition="($isvip==0 and $isvip!='')"}class="active"{/if}>免费</a>
                        <a href="{:url('/books')}?channel={$channel}&cate={$cate}&fullflag={$fullflag}&size={$size}&upday={$upday}&isvip=1&order={$order}" {if condition="($isvip==1)"}class="active"{/if} >收费</a>
                    </span>
                </li>

                <li>
                    <span class="type">状态：</span>
                    <span class="list">
                        <a href="{:url('/books')}?channel={$channel}&cate={$cate}&fullflag=&size={$size}&upday={$upday}&isvip={$isvip}&order={$order}" {if condition="($fullflag=='')"}class="active"{/if}>不限</a>
                        <a href="{:url('/books')}?channel={$channel}&cate={$cate}&fullflag=0&size={$size}&upday={$upday}&isvip={$isvip}&order={$order}" {if condition="($fullflag==0  and $fullflag!='')"}class="active"{/if} >未完结</a>
                        <a href="{:url('/books')}?channel={$channel}&cate={$cate}&fullflag=1&size={$size}&upday={$upday}&isvip={$isvip}&order={$order}"  {if condition="($fullflag==1)"}class="active"{/if}>已完结</a>
                    </span>
                </li>

            </ul>

        </div>

    </div>

        <div class="app_listBlock">

        <div class="app_listBlock_con">
            <ul id="books">
            </ul>
        </div>


    </div>
    
    <div class="app_listBlock app_deleteMargin" >

        <div class="app_reload" id="loading" style="display: none">
                <span class="loader-section">
                    <div class="loader-sectionContainer">
                        <div class="sk-fading-circle">
                            <div class="sk-circle1 sk-circle"></div>
                            <div class="sk-circle2 sk-circle"></div>
                            <div class="sk-circle3 sk-circle"></div>
                            <div class="sk-circle4 sk-circle"></div>
                            <div class="sk-circle5 sk-circle"></div>
                            <div class="sk-circle6 sk-circle"></div>
                            <div class="sk-circle7 sk-circle"></div>
                            <div class="sk-circle8 sk-circle"></div>
                            <div class="sk-circle9 sk-circle"></div>
                            <div class="sk-circle10 sk-circle"></div>
                            <div class="sk-circle11 sk-circle"></div>
                            <div class="sk-circle12 sk-circle"></div>
                        </div>
                    </div>
                    <div class="loader-sectionTips">正在加载更多</div>
                </span>
        </div>

        <div class="app_noData" style="display: none"><span class="noData">没有更多内容了</span></div>

    </div>

    {block name="include"}{include file="public:footer" /}{/block}
    </div>
</div>


{/block}
{block name="script"}
<script type="text/javascript">
var sBookstop=true,sBookstopTime=null;
var cate = {$cate|default=0};
var channel = '{$channel}';
var fullflag = '{$fullflag}';
var size = '{$size}';
var upday = '{$upday}';
var isvip = '{$isvip}';
var order = '{$order}';
var page=1;

$(function(){
	loadingList();
	
	$(window).scroll(function(){
		var nWinH =  document.documentElement.clientHeight;
		var nScrollTop = (document.body.scrollTop || document.documentElement.scrollTop) + nWinH;
		var nBodyScrollH = document.body.scrollHeight;
		if(sBookstop && nBodyScrollH - nScrollTop < 240){
			bookstoptime();
			$('#loading').show();
			$('.app_noData').hide();
			loadingList();
		}
	});
});

function loadingList(){
	$.ajax({
		type: 'get',
		url: '/api/novel/allajax/',
		timeout: 10000,
		//async : false,
		dataType: 'json',
		data: {
			'page': page,
        	'channel':channel,
			'fullflag':fullflag,
			'cate':cate,
			'size':size,
			'upday':upday,
			'isvip':isvip,
			'order':order,
		},
		success: function (data) {
			
			clearTimeout(sBookstopTime);
			if (typeof data == 'string') {
				data = JSON.parse(data);
			}
			console.log(data);
			if(data.code==1){
				var books = data.data;

				var html = "";
				for (var i=0; i < books.length; i++) {
					html += '<li>';
					html += '<a href="/book/info/id/'+books[i].id+'.html">';
					html += '<div class="leftImage"><img src="'+books[i].cover+'" onerror="javascript:this.src=\'/public/novel/images/default.jpg\';"/></div>';
					html += '<div class="rightBlock">';
					html += '<span class="rightBlock_title">'+books[i].title+'</span>';
					html += '<span class="rightBlock_con">';
					html += '<span class="con">'+books[i].intro+'</span>';
					html += '</span>';
					html += '<span class="rightBlock_label">';
					html += '<span class="keyWord_l">';
					html += '<i class="k1">'+books[i].fullflag+'</i>'
					html += '</span>';
					html += '<span class="keyWord_r">';
					html += '<i class="k1">'+books[i].size+'万字</i>';
					html += '<i class="k2">'+books[i].category+'</i>';
					html += '</span>';
					html += '</span>';
					html += '</div>';
					html += '</a>';
					html += '</li>';
				}
				$('#books').append(html);
				page =page+1;
				
				$('.app_reload').show();
				$('.app_noData').hide();
				sBookstop = true;
			}else{
				sBookstop = false;
			    $('#loading').hide();
				$('.app_noData').show();
				return false;
			}
		},
		error: function (XMLHttpRequest, textStatus, errorThrown) {
			$('.app_reload').hide();
			$('.app_noData').show();
			sBookstop = false;
		}
	});
}



//防止重复请求数据
function bookstoptime() {
	clearTimeout(sBookstopTime);
	sBookstop = false;
	sBookstopTime = setTimeout(function () {
		sBookstop = true;
	}, 10000);
}

</script>
{/block}


